package com.botarena.client.bot;

import com.botarena.client.RightMenu;
import com.botarena.shared.ContestInfo;
import com.botarena.shared.UserInfo;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Tworzy elementy GUI zwiazane z BotService
 * 
 * @author wirenth
 * 
 */
public class BotViewer {

	public static Panel createMyBotsPage(UserInfo userInfo, RightMenu rightMenu) {
		VerticalPanel panel = new VerticalPanel();

		Label title = new Label("Edit my bots");
		title.setStyleName("title");
		panel.add(title);

		ContestInfo contest = rightMenu.getSelectedContest();

		if (contest == null) {
			panel.add(new Label("No contest selected"));
		} else {
			BotEditor botEditor = new BotEditor(userInfo, contest);
			panel.add(botEditor.getPanel());
		}

		return panel;
	}
	
	public static Panel createBotPage(String botKey, RightMenu rightMenu) {
		VerticalPanel panel = new VerticalPanel();
		
		Label title = new Label("Bot Homepage");
		title.setStyleName("title");
		panel.add(title);
		
		ContestInfo contest = rightMenu.getSelectedContest();

		if (contest == null) {
			panel.add(new Label("No contest selected"));
		} else {
			BotHomepage homepage = new BotHomepage(botKey);
			panel.add(homepage);
		}
		
		return panel;
	}
}
